package com.suxin.socket.vaca.model;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

/**
 * @author Tang
 * @classname WsResponse
 * @description [  ]
 * @date 2021/4/1 16:34
 */
@Data
@AllArgsConstructor
@Builder
public class WsResponse {

    private int code;
    private String message;
    private Object data;

    public enum Stat {

        CONNECT_FAIL(-1,"connect success"),
        CONNECT_FALI(-2, "connect fail"),
        INVALID_TOKEN(-3, "您的登录已失效，当前设备下线"),
        HEART_BEAT(-101, "pong"),
        CALL_BUSY(1, "用户[id]正在通话中，请稍后再拨"),
        ROOM_DETAIL(2, "房间详情"),
        CALL_ACCEPT(3, "用户[id]进入对话"),
        CALL_REFUSE(4, "用户[id]挂断"),
        FORCE_EXIT(5, "用户[id]通话结束，退出对话");
        ;

        private int code;
        private String desc;

        Stat(int code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public int getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
    }
}